package com.sia.springcloud.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * <p>
 * 通信协议设备表
 * </p>
 *
 * @Author: Sirius
 * @Date: 2022/1/2 14:36
 * @description: 通信协议设备表
 * 所有的通信协议设备信息都存放在该表中
 * 当实现一种新的通信协议的数采微服务的时候，需要谨慎从中选取合适的字段，必须包含的字段如下所示：
 * id: 唯一id
 * collect: 数采状态
 * microservice: 如果该设备正处于数采状态，则为数采微服务的心跳id，否则为nothing
 * protocolName：通信协议名称
 * deviceName：设备名称
 * description：设备描述信息
 * 此外为了提高适配性，还预留了五种字符串字段和三种整型字段
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Device对象", description = "通信协议设备表")
public class Device implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "数采:开启(1)关闭(0)")
    private Integer collect;

    @ApiModelProperty(value = "微服务名")
    private String microservice;

    @ApiModelProperty(value = "通信协议名称")
    private String protocolName;

    @ApiModelProperty(value = "设备名称")
    private String deviceName;

    @ApiModelProperty(value = "描述信息")
    private String description;

    @ApiModelProperty(value = "IP地址")
    private String host;

    @ApiModelProperty(value = "端口号")
    private Integer port;

    @ApiModelProperty(value = "超出时间")
    private Integer timeout;

    @ApiModelProperty(value = "连接限制")
    private Integer connectionLimit;

    @ApiModelProperty(value = "本地端口")
    private Integer localPort;

    @ApiModelProperty(value = "服务id")
    private String serverId;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "字符串变量1")
    private String varStr1;

    @ApiModelProperty(value = "字符串变量2")
    private String varStr2;

    @ApiModelProperty(value = "字符串变量3")
    private String varStr3;

    @ApiModelProperty(value = "字符串变量4")
    private String varStr4;

    @ApiModelProperty(value = "字符串变量5")
    private String varStr5;

    @ApiModelProperty(value = "整型变量1")
    private Integer varInt1;

    @ApiModelProperty(value = "整型变量2")
    private Integer varInt2;

    @ApiModelProperty(value = "整型变量3")
    private Integer varInt3;


    @Override
    public String toString() {
        return "Device{" +
                "id=" + id +
                ", microservice='" + microservice + '\'' +
                ", protocolName='" + protocolName + '\'' +
                ", deviceName='" + deviceName + '\'' +
                ", host='" + host + '\'' +
                ", port=" + port +
                '}';
    }
}
